package org.mpremote.android.framework.database;


import android.content.Context;
import org.mpremote.android.framework.xml.Album;
import org.mpremote.android.framework.xml.Artist;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Gilad
 * Date: 01/10/2010
 * Time: 18:33:59
 */
public class MPDatabaseAccessor {

    private final MPMusicDatabaseHelper musicDatabaseHelper;
    private final Context applicationContext;

    protected MPDatabaseAccessor(Context applicationContext) {
        this.applicationContext = applicationContext;
        this.musicDatabaseHelper = new MPMusicDatabaseHelper(applicationContext);
    }

    public void insertArtists(List<Artist> artists) {
        musicDatabaseHelper.insertArtists(artists);
    }

    public void insertAlbums(List<Album> albumList) {
        musicDatabaseHelper.insertAlbums(albumList);
    }

    public List<Artist> getAllArtists() {
        return musicDatabaseHelper.getAllArtists();
    }

    public List<Album> getAllAlbums() {
        return musicDatabaseHelper.getAllAlbums();
    }

    public void recreateDatabase() {
        musicDatabaseHelper.recreateDatabase();
    }

    public Artist getArtist(String artistName) {
        return musicDatabaseHelper.getArtist(artistName);
    }
}
